<%--
  Created by IntelliJ IDEA.
  User: 12393
  Date: 2021/3/3
  Time: 15:36
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script type="text/javascript" src="../../js/js/jquery-3.3.1.js"></script>
    <script>
        $(function () {
            $.ajax({
                url:"showUserInfo",
                type:'get',
                contentType:"application/json;charset=utf-8",
                dataType:'json',
                success:function (data) {

                    $('#uId').attr("value",data.uId);
                    $('#uName').attr("value",data.uName);
                    $('#uAge').attr("value",data.uAge);
                    $('#uPhone').attr("value",data.uPhone);
                    $('#uEmail').attr("value",data.uEmail);
                    $('#uSex').attr("value",data.uGender);
                    $('#uAddress').attr("value",data.uAddress);
                    $('#uPlace').attr("value",data.uPlace);

                    /*加载单选按钮*/
                    var sex = $("#uSex").val();
                    var radio = $("input[type='radio']");

                    for (var q=0;q<radio.length;q++){
                        if (radio[q].value==sex){
                            radio[q].setAttribute("checked","checked")
                        }
                    }
                }
            })
        })
    </script>
</head>
<body>
<form method="post" action="/saveOk">
    <table>
        <tr hidden="hidden">
            <th>编号：</th>
            <td>
                <input type="text" id="uId" name="uId" >
            </td>
        </tr>
        <tr>
            <th>姓名：</th>
            <td>
                <input type="text" id="uName" name="uName" >
            </td>
        </tr>
        <tr>
            <th>性别：</th>
            <td>
                <input type="hidden" id="uSex"  >
                <input type="radio"  name="uGender" value="男">男
                <input type="radio"  name="uGender" value="女">女
            </td>
        </tr>
        <tr>
            <th>年龄：</th>
            <td>
                <input type="text" id="uAge" name="uAge" >
            </td>
        </tr>
        <tr>
            <th>电话：</th>
            <td>
                <input type="text" id="uPhone" name="uPhone" >
            </td>
        </tr>
        <tr>
            <th>e-mail：</th>
            <td>
                <input type="text" id="uEmail" name="uEmail" >
            </td>
        </tr>
        <tr>
            <th>现居地：</th>
            <td>
                <input type="text" id="uAddress" name="uAddress" >
            </td>
        </tr>
        <tr>
            <th>籍贯：</th>
            <td>
                <input type="text" id="uPlace" name="uPlace" >
            </td>
        </tr>
        <tr>
            <th>
               <button type="submit">修改</button>
            </th>
            <th>
               <button id="back" type="button">返回</button>
            </th>
        </tr>
    </table>
</form>
</body>
<script type="text/javascript" src="../../js/js/jquery-3.3.1.js"></script>
<script>
    $("#back").click(function () {
        window.location="Home";
    })
</script>
</html>
